package com.bocai.grainshop.order.config;

import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import org.springframework.stereotype.Component;

@Component
public class AlipayConfig {
    // 1. 设置参数（全局只需设置一次）
    static {
        Factory.setOptions(getOptions());
    }

    private static Config getOptions() {
        Config config = new Config();

        config.protocol = "https";

        // 沙箱环境为 openapi.alipaydev.com
        config.gatewayHost = "openapi.alipaydev.com";

        config.signType = "RSA2";

        config.appId = "2021000119679624";

        config.merchantPrivateKey = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCH1dFyA5tY3hHm5aL/QFmdPi53YFTwd3M+OfRrvk7MDMEVUOiHX7nzi+CJngOuT+A2uS281GrJ5R19Ull8V0DozqYNdeP7om+4nwD2OGrQ8xXC0lswmz8Bdbtr3PzDAYM3PuqIyPlbnqnP4w+mA13Iokb/TWbcC93G75bDzPGLvFlVn02gbZXyzwLwVczackKcBUQKoag0upfBzAIxWcFV4kCmMYyprBVN8/Dk9QoWFLykqfV44hn1Y+4Cu9HtNrjVmL2VbzVO/OVAJ1btpXJmKtd7HAH7hMTdbdDzlty3iC/IzGVQzd8iiPybA4JDUx4fSy2/+vORf4C01AzG8Y+PAgMBAAECggEAP/D00NjFzcVrY+eBHOqrxIs60FL2aOOxyf76AaXp7b+rPF+DtgXnwK99mQpa7TkIcHom/5Z2VmeVxCJ5oUBpe62bGQb/tLo4IQ4oI79W+NkUy0q+RlkuBX/oI9Q434rcu6rQOGdyiiBcC1H1Uc6P3RwWk6NZ4gdr9HNf4vecVIw7ZxQwaEj7+jQ3O8VCLyrm05AWv1SiWnrVuMRs3F/PCFIfmWWB8oFJuV1CKGm1Tp57fDC3rKsYSEGrRGBCPMa73KOjvSP3jXe0sKJ/eVitjqXadGvZIZdp/8wPH+wen25jjdLfqMFN3JSj9J+lfibEQrekvFnhVuaE7nThmMuxgQKBgQC8V4TCFw1sntHstXJzAjHnIP5ee5pBxjojy6olJlc6G9wJqi9knrEQ8fox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cDKV2qzwfY2+8tV5oDYxpjJ20F5l+UFiGiYkxZuPkkcWUKmOIEgBiIFHkGODoikFNmKlivJf4YKIGL8Q4BrJad4l3yXk064mdfAnAdGUKJY66A+HZkMkGsNVdkJMqB7DLafh1usEqFGilrsH9/B9QG0EQIDAQAB";

        //可设置异步通知接收服务地址（可选）（该地址需要外网能够访问）
        config.notifyUrl = "http://order.grainshop.com/list";

        return config;
    }
}
